package unit5.part2;

public class StaticTest {
    public static void main(String[] args) {
        System.out.println(SonStaticMethod.add(2, 3));

        StaticMethod staticMethod = new SonStaticMethod();// 声明父类，创建子类对象
        System.out.println(staticMethod.add(2, 3));
        System.out.println(staticMethod.delete(2, 3));
    }
}

class StaticMethod {
    static int add(int a, int b) {
        return a + b;
    }

    int delete(int a, int b) {
        return a - b;
    }
}

class SonStaticMethod extends StaticMethod {
    static int add(int a, int b) {// 可以存在同名且同参数的方法，但这不是重写，需要与重写方法做对比来看
        return a * b;
    }

    int delete(int a, int b) {// 有效的重写
        return a / b;
    }
}
